﻿package net.imonair.msn.events {	
	import flash.events.Event;
	import net.imonair.core.events.IIMChatEvent;
	import net.imonair.core.chats.IIMMessage;
	import net.imonair.msn.chats.MSNMessage;
	import net.imonair.msn.chats.MSNSwitchBoard;
	public class MSNChatEvent extends Event implements IIMChatEvent {
		public static const CONNECT				:String = 'msnSwitchBoardConnect';
		public static const START				:String = 'msnConversationStarted';
		public static const USER_IS_TYPING		:String = 'msnUserIsTyping';
		public static const MESSAGE_RECEIVED	:String = 'msnMessageReceived';
		public static const MESSAGE_SENT		:String = 'msnMessageSend';
		public static const MESSAGE_DELIVERED	:String = 'msnMessageDelivered';
		public static const MESSAGE_FAILED		:String = 'msnMessageFailed';
		public static const CONTACT_JOINED		:String = 'msnContactJoined';
		public static const CONTACT_LEFT		:String = 'msnContactLeft';
		private var _message:MSNMessage;
		private var _switchBoard:Object;
		public function MSNChatEvent(type:String, message:MSNMessage = null) {
			super(type, false, false);
			this._message = message;
		}
		public function get message():IIMMessage {
			return this._message;
		}
		override public function clone():Event {
			return new MSNChatEvent(this.type, this._message);
		}
		override public function toString():String {
			return formatToString("MSNChatEvent", "type", "bubbles", "cancelable", "message", "eventPhase");
		}
		
		public function get switchBoard():MSNSwitchBoard
		{
			return this._switchBoard as MSNSwitchBoard;
		}
		public function set switchBoard(switchBoard:MSNSwitchBoard) :void
		{
			this._switchBoard = switchBoard;
		}
	}
}
